package com.itzzy.dice.bean.entity;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;

import java.util.List;
import java.util.Objects;

@Data
public class PlayerInfo {

    private String playerId;

    /**
     * 是否为房间拥有者
     */
    private Boolean isMaster;

    /**
     * 是否为观战者
     */
    private Integer isWatch = 0;

    /**
     * 分数
     */
    private Integer grade = 0;

    /**
     * 下一个游玩的用户id
     */
    private String nextPlayerId;

    private List<Integer> diceList;


    @Override
    public String toString() {
        return StrUtil.join("-", playerId, grade);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PlayerInfo that = (PlayerInfo) o;
        return Objects.equals(playerId, that.playerId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(playerId);
    }

}
